package main

import "fmt"

// 返回一个“返回int的函数”
func fibonacci() func() int {
	num := 0
	pre := 0
	return func() int{
		if num == 0{
			num = 1
		}else{
			tmp := num
			num = num+pre
			pre =tmp
		}
		return pre
	}
}

func main() {
	f := fibonacci()
	for i := 0; i < 10; i++ {
		fmt.Println(f())
	}
}